//
// Created by rengen.gong on 2021/12/8.
//

#ifndef LEARN1_EXCEPTION7_1_H
#define LEARN1_EXCEPTION7_1_H


#include<iostream>

using namespace std;

class A {
    int a;
public:
    A(int i = 0) : a(i) {}

    ~A() { cout << "in A destructor..." << endl; }
};

class B {
    A obj[3];
    double *pb[30];
public:
    B(int k) {
        cout << "int B constructor..." << endl;
        for (int i = 0; i < 10; i++) {
            pb[i] = new double[200000000];
            if (pb[i] == 0)
                throw i;
            else
                cout << "Allocated 20000000 doubles in pb[" << i << "]" << endl;
        }
    }
};

#endif //LEARN1_EXCEPTION7_1_H
